<!--加上setup允许在script中直接编写组合式API-->
<!--<script setup>
import HelloWorld from './components/HelloWorld.vue'
import TheWelcome from './components/TheWelcome.vue'
</script>-->

<!--<script>
// setup
// 1. 执行时机，比beforeCreate还要早
// 2. setup函数中，获取不到this(this是undefined)
// 3. 数据和 函数，需要在setup最后return，才能模板中应用
export default {
  setup () {
    //console.log('setup函数',this)
    // 数据
    const message = 'hello Vue3'
    // 函数
    const logMessage = () => {
      console.log(message)
    }
    
    return {
      message,
      logMessage
    }
  },
  beforeCreate () {
    console.log('beforeCreate函数')
  }
}
</script>-->

<!--语法糖写法 setup 不需要写return了-->
<script setup>
const message = 'hello Vue3'
// 函数
const logMessage = () => {
  console.log(message)
}
</script>

<template>
  <!--<header>
    <img alt="Vue logo" class="logo" src="./assets/logo.svg" width="125" height="125" />

    <div class="wrapper">
      <HelloWorld msg="You did it!" />
    </div>
  </header>

  <main>
    <TheWelcome />
  </main>-->
  
  <div>学习VUE3</div>-->
  <div>{{message}}</div>
  <button @click="logMessage">按钮</button>
  
</template>


<style scoped>
header {
  line-height: 1.5;
}

.logo {
  display: block;
  margin: 0 auto 2rem;
}

@media (min-width: 1024px) {
  header {
    display: flex;
    place-items: center;
    padding-right: calc(var(--section-gap) / 2);
  }

  .logo {
    margin: 0 2rem 0 0;
  }

  header .wrapper {
    display: flex;
    place-items: flex-start;
    flex-wrap: wrap;
  }
}
</style>
